﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CustomerList.ascx.cs" Inherits="Admin_Components_Customer_CustomerList" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<style>
    #ctl00_ContentPlaceHolder1_ctl00_dtpFromDate_dateInput {
        width:131px !important;
    }
</style>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True">
</telerik:RadScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" SelectedIndex="1">
    <Tabs>
         <telerik:RadTab Text="THÔNG TIN TÌM KIẾM" Selected="True">
        </telerik:RadTab>
         <telerik:RadTab Text="THÔNG TIN KHÁCH HÀNG" >
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>
     <telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
    <!--Tab thông tin tim kiem -->
        <telerik:RadPageView ID="RadPageView1" runat="server" Height="190px" Style="overflow: hidden">
                 <fieldset class="form" id="fsGeneral">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                <div class="row col-md-12">
                 <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã khách hàng</label>
                        <div class="col-md-3">
                            <telerik:RadTextBox ID="txtCustomerCodeNew" CssClass="col-imp-12 required"  runat="server"   />
                        </div>
                        <label class="col-md-2 control-label">Điện thoại </label>
                        <div class="col-md-4">
                            <telerik:RadTextBox ID="txtPhoneNumber" CssClass="col-imp-8 required"  runat="server"   />
                           
                        </div>
                    </div>
                  <!--End Dòng -->
                    
                  <!--End Dòng -->
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tên khách hàng </label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtCustomerNameNew" CssClass="col-md-6"  runat="server"   />
                          
                        </div>
                    </div>
                    
                     <div class="form-group">
                        <label class="col-md-3 control-label">
                           Từ ngày</label>
                        <div class="col-md-3">
                            <telerik:RadDatePicker ID="dtpFromDate" cssclass="col-imp-8" enabled="true" runat="server">
                                <Calendar ID="Calendar2" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput Enabled="False" style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"></DateInput>
                            </telerik:RadDatePicker>
                        </div>
                        <label class="col-md-2 control-label">Đến ngày </label>
                        <div class="col-md-4">
                            <telerik:RadDatePicker ID="dtpToDate" cssclass="col-imp-8" enabled="true" runat="server">
                                <Calendar ID="Calendar1" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput Enabled="False" style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"></DateInput>
                            </telerik:RadDatePicker>
                        </div>
                    </div>
                 </div>
                <!--End Block bên trái -->
                <!--Block bên phải -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                           Địa chỉ </label>
                        <div class="col-md-9">
                            <telerik:radtextbox ID="txtAddress" CssClass="col-md-6 inputForm"  runat="server"/>
                              
                        </div>
                    </div>
                  <!--End Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Tỉnh/Thành </label>
                        <div class="col-md-3">
                           <telerik:RadComboBox ID="cboProvince" runat="server" CssClass="col-imp-12 required" OnSelectedIndexChanged="cboProvince_SelectedIndexChanged" AutoPostBack="true" />
                            
                         </div>
                         <label class="col-md-3 control-label">Quận/Huyện </label>
                        <div class="col-md-3">
                           <telerik:RadComboBox ID="cboDistrict" runat="server" CssClass="col-imp-12 required" />
                              
                         </div>
                    </div>
                    
                  <!--End Dòng -->
                 </div>
                <!--End Block bên phải -->
            </div>
        </div>
        <!--Action-->
        <div class="set-btns text-center">
            <asp:Button ID="btnCusSearch" CssClass="btn btn-sm btn-primary" runat="server" Text="Tìm kiếm" OnClick="btnCusSearch_Click"/>
        </div>
        </fieldset>
        </telerik:RadPageView>
         <!--Tab thông tin khach hang -->
         <telerik:RadPageView ID="RadPageView2" runat="server" Height="205px" Style="overflow: hidden">
                 <fieldset class="form" id="Fieldset2">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                <div class="row col-md-12">
                 <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã khách hàng</label>
                        <div class="col-md-3">
                            <telerik:RadTextBox ID="txtCustomerCodeCreate" CssClass="col-imp-12" enabled="false"  runat="server"   />
                        </div>
                  </div>
                <!--End Dòng -->
                    
                <div class="form-group">
                    <label class="col-md-3 control-label">Điện thoại</label>
                    <div class="col-md-5">
                        <telerik:RadTextBox ID="txtPhoneNumberCreate" CssClass="col-imp-12"  runat="server"   />
                        
                    </div>
                </div>
                  
                  <!--End Dòng -->
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tên khách hàng <span style="color:red;">(*)</span></label>
                        <div class="col-md-5">
                            <telerik:RadTextBox ID="txtCustomerNameCreate" CssClass="col-md-6"  runat="server"   />
                             <asp:RequiredFieldValidator  ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtCustomerNameCreate" ValidationGroup="g5"
                           ErrorMessage="" ></asp:RequiredFieldValidator>
                        </div>
                    </div>
                     
                 </div>
                <!--End Block bên trái -->
                <!--Block bên phải -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                           Địa chỉ</label>
                        <div class="col-md-9">
                            <telerik:radtextbox ID="txtAddressCreate" CssClass="col-md-6 inputForm"  runat="server"/>
                              
                        </div>
                    </div>
                  <!--End Dòng -->
                     <div class="form-group">
                        <label class="col-md-3 control-label">Tỉnh/Thành</label>
                        <div class="col-md-3">
                           <telerik:RadComboBox ID="cboProvinceCreate" runat="server" CssClass="col-imp-12 star" OnSelectedIndexChanged="cboProvinceCreate_SelectedIndexChanged" AutoPostBack="true" />
                            
                         </div>
                         <label class="col-md-3 control-label">Quận/Huyện</label>
                        <div class="col-md-3">
                           <telerik:RadComboBox ID="cboDistrictCreate" runat="server" CssClass="col-imp-12 star" />
                              
                         </div>
                    </div>
                    
                  <!--End Dòng -->
                 </div>
                <!--End Block bên phải -->
            </div>
            </div>
        <!--Action-->
        <div class="set-btns text-center">
            <asp:Button ID="btnSave" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu" OnClick="btnSave_Click" ValidationGroup="g5" OnClientClick="return ValidateDelivery();"/>
        </div>
        </fieldset>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
   
             <div class="row">
                 <telerik:RadGrid ID="gv" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                    AllowMultiRowSelection="True" GridLines="None" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-BorderStyle="None" CssClass="table table-bordered" AllowPaging="true"
                    PageSize="50" AllowCustomPaging="true" OnNeedDataSource="gvData_NeedDataSource" OnItemCommand="gvData_ItemCommand">
                    <MasterTableView AllowPaging="True" PageSize="50" EditMode="InPlace" ShowHeader="true"
                        AutoGenerateColumns="False" NoMasterRecordsText="Không có dữ liệu.">
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        </ExpandCollapseColumn>
                        <Columns>
                   <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" 
                        HeaderStyle-Width="50px">
                        <ItemTemplate>
                            <%# Eval("RowID") %></ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridTemplateColumn>
                    
                    <telerik:GridTemplateColumn SortExpression="CustomerCode" HeaderText="Mã khách hàng"  UniqueName="CustomerCode">
                    <ItemTemplate>
                      <asp:Label  ID="lnkCustomerCode" runat="server" Text='<%# Eval("CustomerCode") %>' style="cursor:pointer;text-decoration:none;font-weight:bold;" ></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Width="70px" />
                    <ItemStyle HorizontalAlign="Left" Width="70px" />
                    </telerik:GridTemplateColumn>
                     <telerik:GridBoundColumn DataField="CustomerName" HeaderStyle-HorizontalAlign="Center" 
                        ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                        HeaderText="Tên khách hàng" UniqueName="CustomerName">
                        <HeaderStyle HorizontalAlign="Left" Width="150px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Left" Font-Bold="true"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="Address" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Địa chỉ" UniqueName="Address">
                    <HeaderStyle HorizontalAlign="Left" Width="200px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="District" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Quận/Huyện" UniqueName="District">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Province" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Tỉnh/Thành" UniqueName="Province">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="PhoneNumber" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Điện thoại" UniqueName="PhoneNumber">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="CreatedDate" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Ngày tạo" UniqueName="CreatedDate">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Tổng tiền tích lũy">
                        <ItemTemplate>
                            <a data-url='/Admin/Components/Customer/SaleOrderList.aspx?CustomerID=<%# Eval("CustomerCode") %>' data-toggle="modal" data-target="#myModal" style="cursor:pointer;color:green;font-weight:bold;">
                                
                                <%# String.Format("{0:#,#.##}", float.Parse(Eval("AccumulateAmount").ToString() == "" ? "0" : Eval("AccumulateAmount").ToString()))%>
                            </a>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridTemplateColumn>
                  
                      <telerik:GridBoundColumn DataField="ConvertedAmount" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" FilterControlAltText="Filter Remark column" DataFormatString="{0:###,###}"
                    HeaderText="Tổng tiền đã quy đổi" UniqueName="ConvertedAmount">
                    <HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="RemainAmount" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Center" FilterControlAltText="Filter Remark column" DataFormatString="{0:###,###}"
                    HeaderText="Tổng tiền tích lũy còn lại" UniqueName="RemainAmount">
                    <HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Sửa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                        <asp:Button ID="btnEdit" CssClass="btnEdit" CommandArgument='<%# Eval("ID")%>'
                        CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                        <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>

                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
                </MasterTableView>
                <ClientSettings>
                <Selecting AllowRowSelect="true" /></ClientSettings>
                <ClientSettings>
                <Scrolling AllowScroll="true" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                </ClientSettings>
                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                </telerik:RadGrid>
            </div>
 
    </ContentTemplate>
</asp:UpdatePanel>

<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>